Skip to content

feat: Add "semble savings" command#76

Merged
Pringled merged 21 commits into
mainfrom
add-saved-tokens-logging
May 11, 2026
Merged

feat: Add "semble savings" command#76
Pringled merged 21 commits into
mainfrom
add-saved-tokens-logging

Conversation

@Pringled

@Pringled Pringled commented May 7, 2026

Copy link
Copy Markdown
Member

This PR adds semble savings, a CLI command that tracks and displays token savings across all searches. Stats are recorded automatically to ~/.semble/savings.jsonl on every search. There's also a verbose output that shows the calls per call type but it's not that interesting (yet) since we only have search and find_related atm.

Example output 💅 ✨:

  Semble Token Savings
  ════════════════════════════════════════════════════════════════
  Period        Calls   Savings
  ────────────────────────────────────────────────────────────────
  Today         42      [███████████████░]  ~58.4k tokens (95%)
  Last 7 days   287     [██████████████░░]  ~312.4k tokens (90%)
  All time      1.4k    [██████████████░░]  ~1.2M tokens (89%)

@Pringled
Pringled requested a review from stephantul May 7, 2026 15:47
@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/semble/cli.py 100.00% <100.00%> (ø)
src/semble/index/index.py 100.00% <100.00%> (ø)
src/semble/stats.py 100.00% <100.00%> (ø)
src/semble/types.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stephantul stephantul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the code here is overly defensive, lots of guards and checks. But we control the data sources on both ends, so there is likely no need to ever check most of the things. Specifically, I think the gets with defaults of 0 actually hurt rather than help, because they obscure other bugs, and can lead to silent over- or underestimations of the stats.

Comment thread src/semble/index/index.py Outdated
Comment thread src/semble/index/index.py Outdated
Comment thread src/semble/stats.py Outdated
Comment thread src/semble/stats.py Outdated
Comment thread src/semble/stats.py Outdated
Comment thread src/semble/stats.py
Comment thread src/semble/stats.py
Comment thread src/semble/stats.py Outdated
Comment thread src/semble/index/index.py Outdated
@Pringled
Pringled merged commit c64b018 into main May 11, 2026
13 checks passed
@Pringled
Pringled deleted the add-saved-tokens-logging branch May 11, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants